package com.siashan.sensitive.serializer;

/**
 * 能否进行脱敏处理默认实现类
 *
 * @author siashan
 * @date 2023/5/24
 * @since 1.2.1
 */
public class DefaultStrategy extends AbstractSensitiveStrategy {

    @Override
    public String serialize(String s) {
        String output = "";
        int length = s.length();
        if (length >= 3) {
            output = s.charAt(0) + "*" + s.charAt(length - 1);
        } else if (length == 2) {
            output = s.charAt(0) + "*";
        } else {
            output = s;
        }
        return output;
    }
}
